package com.neusoft.elm.service.impl;

import com.neusoft.elm.dao.BusinessDao;
import com.neusoft.elm.dao.impl.BusinessDaoImpl;
import com.neusoft.elm.po.Business;
import com.neusoft.elm.service.BusinessService;
import com.neusoft.elm.util.DBUtil;

import java.util.List;

public class BusinessServiceImpl implements BusinessService {
    BusinessDao dao = new BusinessDaoImpl();
    @Override
    public List<Business> listBusinessByOrderTypeId(Integer orderTypeId) throws Exception {
        try {
            DBUtil.getConnection();
            List<Business> list = dao.listBusinessByOrderTypeId(orderTypeId);
            return list;
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        } finally {
            DBUtil.close();
        }
    }

    @Override
    public Business getBusinessById(Integer businessId) throws Exception {
        try {
            DBUtil.getConnection();
            Business businessById = dao.getBusinessById(businessId);
            return businessById;
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        } finally {
            DBUtil.close();
        }
    }
}
